﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;

namespace BtcPay
{
    public static class Utilities
    {
        public static KeyValuePair<string, string> GenerateNewAddress()
        {
            var wc = new WebClient();
            var tmp = wc.DownloadString("https://blockchain.info/de/q/newkey");
            var tmparr = tmp.Split(' ');

            var ret = new KeyValuePair<string, string>(tmparr[0], tmparr[1]);

            return ret;
        }

        public static string ConvertToBtc(string currency, string value)
        {
            var wc = new WebClient();

            return wc.DownloadString(string.Format("https://blockchain.info/tobtc?currency={0}&value={1}", currency.ToUpper(), value));
        }
    }
}